<?php

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

$categories=mysql_query("SELECT * FROM `cat` ORDER BY `order`");

//mysql_query("SELECT * FROM `posts` ORDER BY `time` DESC LIMIT 3");
while($row=mysql_fetch_assoc($categories)){
    echo '<div class="title"><a href="cat/index.php?id='.$row['id'].'">'.$row['name'].'</a></div>';
    
    $posts=mysql_query("SELECT * FROM `posts` WHERE `catid` = '$row[id]' ORDER BY `time` DESC LIMIT 3");
    while($post=mysql_fetch_assoc($posts)){  
        
    echo '<div class="small"><a class="url" href="posts/index.php?id='.$post['id'].'">'.$post['name'].'</a></div>';
    
    }
    
    };

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

?>